<template>
  <div>
    <h1>page2</h1>
    <input type="text" placeholder="000" v-model="res">
    <p @click="aaa">点击</p>
    <h1>{{b}}</h1>
    <button @click="change">change</button>
    <!--<h3 v-for="(item, key) in even" :key="key">{{item}}</h3>-->
  </div>
</template>

<script>
  import {mapState, mapGetters, mapMutations, mapActions} from 'vuex';
export default {
  name: "page2",
  data() {
    return {
      res: '',
      aa: [],
    }
  },
  computed: {
    ...mapState(['a', 'b']),
    ...mapGetters(['even']),
  },
  methods: {
    aaa() {
      // this.$store.state.a = this.res;
      // console.log(this.$store.state.a);
      // console.log(this.$store.state.array.push(this.res));
      this.aa.push(this.res);
      this.$store.state.array = this.aa;
      console.log(this.$store.state.array)
    },
    ...mapMutations(['change']),
  },
}
</script>

<style scoped>
  *{
    font-size: 20px;
  }
</style>
